/*
 * @ProjectName: 编程学习
 * @Copyright:   2019 HangZhou Yi Dev, Ltd. All Right Reserved.
 * @address:     https://yiyuery.github.io/
 * @date:        2019/5/20 20:57
 * @email:       xiazhaoyang@live.com
 * @description: 本内容仅限于编程技术学习使用，转发请注明出处.
 */
package com.example.template.pattern.factory.factory;

import com.example.template.pattern.factory.af.PhoneFactory;
import com.example.template.pattern.factory.base.AbstractPhone;
import com.example.template.pattern.factory.base.phone.PhoneType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 *
 * </p>
 *
 * @author Yi
 * @version v1.0.0
 * @date 2019-08-11 18:42
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify By: {修改人} 2019-08-11
 * @modify reason: {方法名}:{原因}
 * ...
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public abstract class AbstractAgent {

    /**
     * 服务于抽象工厂模式
     */
    private PhoneFactory factory;

    /**
     * 订购
     * @return
     */
    public AbstractPhone orderPhone(PhoneType type){
        //调用子类实现的工厂方法
        return producePhone(type);
    }

    /**
     * 声明工厂方法
     * @param type
     * @return
     */
    protected abstract AbstractPhone producePhone(PhoneType type);
}
